# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=pptx
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}"
         "${MINGW_PACKAGE_PREFIX}-python2-${_realname}")
pkgver=0.6.5
pkgrel=1
pkgdesc="Create Open XML PowerPoint documents in Python (mingw-w64)"
url="https://github.com/scanny/python-pptx"
arch=('any')
license=('BSD')
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python2-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python3-mock"
              "${MINGW_PACKAGE_PREFIX}-python3-pyparsing>=2.0.1"
              "${MINGW_PACKAGE_PREFIX}-python3-pytest"
              "${MINGW_PACKAGE_PREFIX}-python2-mock"
              "${MINGW_PACKAGE_PREFIX}-python2-pyparsing>=2.0.1"
              "${MINGW_PACKAGE_PREFIX}-python2-pytest")
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/scanny/python-pptx/archive/v${pkgver}.tar.gz")
sha256sums=('36dc034853a4abee679db3920aae9c6b71282c311ca8ac79ece0ab3a9cf5f308')


prepare() {
  cp -a python-pptx-${pkgver} python-pptx-${pkgver}-py2
}

build() {
  cd ${srcdir}/python-pptx-${pkgver}
  python3 setup.py build

  cd ${srcdir}/python-pptx-${pkgver}-py2
  python2 setup.py build
}

#check() {
#  cd ${srcdir}/python-pptx-${pkgver}
#  py.test-3.6.exe
#
#  cd ${srcdir}/python-pptx-${pkgver}-py2
#  py.test-2.7
#}

package_python3-pptx() {
  depends=("${MINGW_PACKAGE_PREFIX}-python3-lxml>=3.1.0"
           "${MINGW_PACKAGE_PREFIX}-python3-pillow>=2.6.1"
           "${MINGW_PACKAGE_PREFIX}-python3-xlsxwriter>=0.5.7")

  cd ${srcdir}/python-pptx-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE
}

package_python2-pptx() {
  depends=("${MINGW_PACKAGE_PREFIX}-python2-lxml>=3.1.0"
           "${MINGW_PACKAGE_PREFIX}-python2-pillow>=2.6.1"
           "${MINGW_PACKAGE_PREFIX}-python2-xlsxwriter>=0.5.7")

  cd ${srcdir}/python-pptx-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE
}

package_mingw-w64-i686-python2-pptx() {
  package_python2-pptx
}

package_mingw-w64-i686-python3-pptx() {
  package_python3-pptx
}

package_mingw-w64-x86_64-python2-pptx() {
  package_python2-pptx
}

package_mingw-w64-x86_64-python3-pptx() {
  package_python3-pptx
}

# vim:set ts=2 sw=2 et:
